package com.twu.biblioteca.operation;

import com.twu.biblioteca.model.Account;
import com.twu.biblioteca.service.UserService;

import static java.lang.String.format;

public class ViewUserOperation extends Operation {
    UserService userService;

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @Override
    public String operate(String[] args) throws Exception {
        Account account = userService.getUserById(args[0]);
        return format("|%s|%s|%S",
                account.getName(),
                account.getEmail(),
                account.getPhoneNumber());
    }
}
